<template>
  <div>
    <Table :columns="columns1" :data="data1"></Table>
  </div>

</template>
<script>
import { queryTeacherPublishTask } from '@/api/lky/lkyStudent'
import { createFormObj, getToken } from '@/libs/util'

import Add from './add.vue'
export default {
  components: {
    Add
  },
  data () {
    return {
      columns1: [
        {
          title: '老师',
          key: 'name'
        },
        {
          title: '表名',
          key: 'file_name'
        },
        {
          title: '发布时间',
          key: 'creation_time'
        },
        {
          title: '操作',
          key: 'action',
          width: 250,
          align: 'center',
          render: (h, params) => {
            return h('div', [
              h(
                'Button',
                {
                  props: {
                    size: 'small'
                  },
                  style: {
                    marginRight: '5px'
                  },
                  on: {
                    click: () => {
                      this.$router.push({
                        path: '/onlineView/onlineRoutePage',
                        query: {
                          newFileName: params.row.new_file_name
                        }
                      })
                    }
                  }
                },
                '预览'
              )
            ])
          }
        }
      ],
      data1: [
      ],
      isOpenAddPage: false
    }
  },
  methods: {
    handleOpenPage (name) {
      // 打开页面事件(添加页,编辑页...)
      if (name === 'upload') this.isOpenAddPage = true
      else if (name === 'edit') {
        this.isOpenEditPage = true
      }
    }
  },
  mounted () {
    queryTeacherPublishTask({
      uid: getToken()
    }).then(res => {
      this.data1 = res.data
    }).catch(err => {
      this.$Message.error(err)
    })
  }
}
</script>
